﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Outlook;
using Toodledo.Model;

namespace Sync.Outlook
{
    public static class Extensions
    {
        #region Members

        #endregion

        #region Constructors & Init

        #endregion

        #region Public Methods
        public static string GetCategory(this TaskItem taskItem)
        {
            string categoryset = taskItem.Categories;
            if (categoryset != null)
            {
                string[] categories = categoryset.Split(',');
                return categories[0];
            }
            return "";
        }

        public static int GetId(this TaskItem taskItem)
        {
            ItemProperty ip= taskItem.ItemProperties["Id"];
            if (ip != null) return ip.Value;
            return -1;
        }

        public static void SetId(this TaskItem taskItem, int value)
        {
            ItemProperty ip = taskItem.ItemProperties.Add("Id", OlUserPropertyType.olInteger);
            ip.Value = value;    
        }       

       

        #endregion

        #region #Events & Invokables

        #endregion

        #region Private Methods

        #endregion

        #region EventHandlers

        #endregion
    }
}
